<?php
	require("frmCookie.php");	
	require("includes/clsWorkDays.php");
	
	$iOpcion = 1;
?>
<html>
	<head>
    	<?php
		require("frmHeader.php");
		?>
	</head>
	<body>
    	<table cellpadding="0" cellspacing="0" align="center" class="tablaPrincipal">
        	<tr>
            	<td align="center">
                	<?php
					require("frmSession.php"); 
					
					//Redirecciona a SINPERMISOS.PHP en caso de no tener permisos
					switch ($iOpcion)
					{
						case 1:
						{
							
							if (!(in_array(6005, $_SESSION[permisos])))
							{
							?>
							  <script language="JavaScript" type="text/javascript">
							  <!--
							  window.location.href = "sinPermisos.php"
							  //-->
							  </script>
							<?php
							}
							$titulo = "Ver Remito";
							break;
						}
					}
					
					?>
                </td>
            </tr>
            <tr>
            	<td align="center">
                	<?php
					require("frmTitulo.php");
					?>
                </td>
            </tr>
            <?php 
            if($iOpcion != 3) 
        	{
            ?>
            <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
            	<td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="menuPrincipal">
                    	<tr>
                        	<td>
								<?php
                                require("frmMenu.php");
                                ?>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
                <td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="tituloPantalla">
                    	<tr>
                        	<td align="center">
                            	<p class="texto" align="left"><?php echo $titulo; ?></p>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
             <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <tr>
                <td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="estadoPantalla">
                    	<tr>
                        	<td align="center">
                            	<p class="texto" align="left"><?php echo $mensaje; ?></p>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
             <tr>
            	<td height="20">&nbsp;
                	
                </td>
            </tr>
            <?php 
        	}
            ?>
            <tr>
                <td align="center">
                	<table cellpadding="0" cellspacing="0" align="center" class="contenedorPrincipal">
                    	<tr>
                        	<td align="">
                        		<form name="frm">
	                        		<table>
	                        			<tr>
	                        				<td colspan="9"><b> Número de Remito de Ingreso: &nbsp; <?php echo $_GET[iNroRemito]?></b></td>
	                        			</tr>
	                        			<tr>
	                        				<td>&nbsp;</td>
	                        			</tr>
	                        			<tr>
	                        				<th class="listaHead">Nro.Orden</th>
	                        				<th class="listaHead">Imei</th>
	                        				<th class="listaHead">Estado</th>
	                        				<th class="listaHead">Almacen</th>
	                        				<th class="listaHead">Marca</th>
	                        				<th class="listaHead">Modelo</th>
                                            <th class="listaHead">Referencia</th>
	                        			</tr>
	                        			<?php
	                        			$i=0;
	                        			$mySQL = "SELECT O.*, E.nombre AS ESTADO, A.nombre AS ALMACEN, MC.nombre AS MARCA, M.nombreComercial AS MODELO FROM ordenes O, estados E, almacenes A, marcas MC, modelos M WHERE O.idEstado = E.idEstado AND O.idAlmacen = A.idAlmacen AND O.idModelo = M.idModelo AND M.idMarca = MC.idMarca AND O.nroRemitoEmisor='" . $_GET[iNroRemito] . "'";
	                        			$result = readSQL($mySQL);
	                        			foreach($result as $value)
	                        			{
	                        				if($i%2==0)
		  				                		$class = "par";
		  				                	else
		  				                		$class = "impar";
										?>
										<tr>
											<td class="<?php echo $class; ?>" align="right"><?php echo $value['idOrden']; ?></td>
											<td class="<?php echo $class; ?>"><?php echo $value['imei']; ?></td>
											<td class="<?php echo $class; ?>"><?php echo $value['ESTADO']; ?></td>
											<td class="<?php echo $class; ?>"><?php echo $value['ALMACEN']; ?></td>
											<td class="<?php echo $class; ?>"><?php echo $value['MARCA']; ?></td>
											<td class="<?php echo $class; ?>"><?php echo $value['MODELO']; ?></td>
                                            <td class="<?php echo $class; ?>"><?php echo $value['codigoReferencia']; ?></td>
										</tr>
										<?php
											$i++;      
	                        			}
	                        			?>
	                        			<tr>
	                        				<td align="center" colspan="7"><input type="button" name="cmdVolver" value="Volver" onClick="history.go(-1);"></td>
	                        			</tr>
	                        		</table>
                        		</form>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
	</body>
</html>